package edu.bw.restful;

import edu.bw.vo.User;
import lombok.Data;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class RestfulUserDemo {
    @GetMapping("/{id}")
    public User getUser(@PathVariable("id") Integer uid){

        return new User(uid,"张三","123");
    }
    @PostMapping
    public User addUser(@RequestBody User user){
        System.out.println("添加用户"+user);
        return user;
    }
    @PutMapping
    public User updateUser(@RequestBody User user){
        System.out.println("更新用户"+user);
        return user;
    }
    @DeleteMapping("/{id}")
    public void deleteUser(@PathVariable("id") Integer id){
        System.out.println("删除用户"+id);
    }

}
